UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'XPEJMuVex4Ol+yINvL/8aZ53vQahFS1ren2c6yJpx2I='
WHERE
key_id = '1c7815279867202aef553eb254471a8d03e99fbcad9fe55f4378a916aca94cc0'
AND (
token = 'XPEJMuVex4Ol+yINvL/8aZ53vQahFS1ren2c6yJpx2I='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)