UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'KtvJzFlxlHplRiyYjn9Pawz6plQJPqnZ1lmHwziO5bM='
WHERE
key_id = 'eb1f1f985fd3e8331faa2b8b75a6c44832c082259312bec420214d43cdd4b669'
AND (
token = 'KtvJzFlxlHplRiyYjn9Pawz6plQJPqnZ1lmHwziO5bM='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)