UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'wRwwNS0LEtgUODlTNg4YdfgVVqZa82+b+AZyTu7gepk='
WHERE
key_id = '589035200ef20df6ab1791db6504b4cfc4901c3a6ac13cc0dfeabb82ebf07f44'
AND (
token = 'wRwwNS0LEtgUODlTNg4YdfgVVqZa82+b+AZyTu7gepk='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)