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

Query time 0.00026