UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = '+DS3PZGAQx4IVKSYBzzazVsUV30Bvs0h9BwGE1VSEy4='
WHERE
key_id = '87eda2395f5f82900be8c2bf125b3a7f3e8a039b746b1df38375d8ad59639c3b'
AND (
token = '+DS3PZGAQx4IVKSYBzzazVsUV30Bvs0h9BwGE1VSEy4='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)