UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'Go5dPIbdnnfkV+KXh13DsoPgggOChJynkdqTrFnA49c=' 
WHERE 
  key_id = '01b754588208e76873005f994769b7927e1342c191496f071aecac610ddcecab' 
  AND (
    token = 'Go5dPIbdnnfkV+KXh13DsoPgggOChJynkdqTrFnA49c=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00032