UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'wB8S5YIyK2i4W3kDirUQNan+B2QpabhsdvlDFYSkPi8='
WHERE
key_id = '8d69777cb3f4a22a31c323eeb28e839d7f271583d92a040b538147ea4db0b18e'
AND (
token = 'wB8S5YIyK2i4W3kDirUQNan+B2QpabhsdvlDFYSkPi8='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)