UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'N6W90pHIJRA6pHd25vGOLOSbobTNKASKULLq7cg670c='
WHERE
key_id = '469aafeecb8cf586730b6c953383d8ccdd30252e306f3ea5e699e17ae8cd1d28'
AND (
token = 'N6W90pHIJRA6pHd25vGOLOSbobTNKASKULLq7cg670c='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)