UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'VK6l0eNPxWKHz+4S7rZDz7I3U4AIHZU/EzQu/N7+0dM=' 
WHERE 
  key_id = '1dcee983e9fe54047101b222ea43cf7023a792cfe42e4b82ff750e4751696335' 
  AND (
    token = 'VK6l0eNPxWKHz+4S7rZDz7I3U4AIHZU/EzQu/N7+0dM=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00054