UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'N0ewW95dzs9orFzmdnF2lxAobxL8efl/F/Y+/SxBrUk=' 
WHERE 
  key_id = '902338cb29ba887403dd21edbe8f9c49552f17d0a1dbecbd65e0abde3a47a78a' 
  AND (
    token = 'N0ewW95dzs9orFzmdnF2lxAobxL8efl/F/Y+/SxBrUk=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00072