UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'Pg+WFW7Ci2WHp5sU8COf5e4c8Xb1IsqFjZEpL0vNksk=' 
WHERE 
  key_id = '6ce717b5b5d535c422a0a35a63772045fb0f15015c12da251443dd216f130b3d' 
  AND (
    token = 'Pg+WFW7Ci2WHp5sU8COf5e4c8Xb1IsqFjZEpL0vNksk=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00034