UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'erYSqBkjoiN+Hl2hLqvfkgatxdO5W6cOAkbUST2ZuQ4='
WHERE
key_id = 'ecc3ed6896c45f9fcf772f96a5d0809f3f94078ecf033594c79a50bccf0de0ee'
AND (
token = 'erYSqBkjoiN+Hl2hLqvfkgatxdO5W6cOAkbUST2ZuQ4='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)