UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = '1AQlsqWKEYdC2oMEE1zzyLmZIakhAg2Tz8PPbUxj2N4=' 
WHERE 
  key_id = '6637bbab6688d9e959a3da3ee855cbe7c90abaf9b43e894088feeb984666a091' 
  AND (
    token = '1AQlsqWKEYdC2oMEE1zzyLmZIakhAg2Tz8PPbUxj2N4=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00035