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