UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'a7ye1+9PIeuYEdkbGmut2UZuEsNFct04kUrkxGAR73g='
WHERE
key_id = 'b160f7eb9d4db0d0b83a04a09fe0ec004f55140c1a22caa8c299cf56e5d0ea20'
AND (
token = 'a7ye1+9PIeuYEdkbGmut2UZuEsNFct04kUrkxGAR73g='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)