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