UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'sb5dNGAoFPsk4Sa7NoL0o4pDP+xcboHy4+VcBJpynVs='
WHERE
key_id = '8ed0b93bd19f0c3e10f1f0133a90c9f37e53286dc35b188db77f671cf516a250'
AND (
token = 'sb5dNGAoFPsk4Sa7NoL0o4pDP+xcboHy4+VcBJpynVs='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)