UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'TvrAM06arG0C0+us6aTiwj/AKp4vXuKinZkdkbycrlY=' 
WHERE 
  key_id = 'aaabab753e79ebc6f46a34dda83d2ed009f779fd408dfdffc3934015487bb438' 
  AND (
    token = 'TvrAM06arG0C0+us6aTiwj/AKp4vXuKinZkdkbycrlY=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00031