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

Query time 0.00023