UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'qR611v3az+iBvlD9oc30h98Obaartn0F3s+vtg7+4AM=' 
WHERE 
  key_id = '7ee0c8cedb729f976c23f8f2bb2a7f3d2d65ea28d0a43ca61dfa4f60b9aad691' 
  AND (
    token = 'qR611v3az+iBvlD9oc30h98Obaartn0F3s+vtg7+4AM=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00033