UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'Z5MDccr3ajQFyFHMX5VsxYisTgcMpKFUPzKt/zXXMU4='
WHERE
key_id = 'a13a2bc226e1a8964132085a2ca5fcf9c4ec5eb7418c9cc02d486ee02dd67e55'
AND (
token = 'Z5MDccr3ajQFyFHMX5VsxYisTgcMpKFUPzKt/zXXMU4='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)