UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'lpRirir+UGRvjEIMzkivJ6ASiN84LEHLagHcbxQd3bo=' 
WHERE 
  key_id = '43c586da4ae7626f7c59c543a81c36c6fa352875b96a399d649b0147db05100f' 
  AND (
    token = 'lpRirir+UGRvjEIMzkivJ6ASiN84LEHLagHcbxQd3bo=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00025