UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'h8kCBy17tGFDYqzVTV11cCF8aGowWqkecon2qGlv0uI=' 
WHERE 
  key_id = '67242e757d157c2197fd2584f87ef5901e24a607918042b5e694d3d5ed3a1ccd' 
  AND (
    token = 'h8kCBy17tGFDYqzVTV11cCF8aGowWqkecon2qGlv0uI=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00053