UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'DNf1ivmXMh+jbTknwwA/YkhgtzgBPDAD7juYueR1s1A=' 
WHERE 
  key_id = 'ab5c28038a4790c475098db83f380f512960cc446c804e654dd82dc7c7b57589' 
  AND (
    token = 'DNf1ivmXMh+jbTknwwA/YkhgtzgBPDAD7juYueR1s1A=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00033