UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'fDaRt1B64OkWU0BPQB6/MBk5jNNF2/m2PCQ2Ru/rD64='
WHERE
key_id = '8b4355ccdd101157154016ac7cb2958924149d92993c573f345680608dfd6543'
AND (
token = 'fDaRt1B64OkWU0BPQB6/MBk5jNNF2/m2PCQ2Ru/rD64='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)