UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'iNd+zNLL+03Ei0pmeGVGWHV3SoBAXbXd6o1hy1W8fBk='
WHERE
key_id = 'c77c0e4f8e0e52314f355d91d67a53cf3cd0832f2f08456297c7dd940781d514'
AND (
token = 'iNd+zNLL+03Ei0pmeGVGWHV3SoBAXbXd6o1hy1W8fBk='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)