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

Query time 0.00051