UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'gdCZ40fIUVyF3RlFdew9oG35VcatxCDR355UA41Sxlc=' 
WHERE 
  key_id = 'b99f37e058e15cacd52587b61b7467ed637f17243bc601f8369b9cb6d1522180' 
  AND (
    token = 'gdCZ40fIUVyF3RlFdew9oG35VcatxCDR355UA41Sxlc=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00055