UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'avP6XxmTJBndS9LLDV03XDV775pDzQzXfGrUdgjYk3w='
WHERE
key_id = 'a25f50a544992573364354e805a0ee32c20a8ea84f886a976460815834c14a33'
AND (
token = 'avP6XxmTJBndS9LLDV03XDV775pDzQzXfGrUdgjYk3w='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)